
<%
  form_url = comment.persisted? ? issue_comment_path(comment.issue, comment) : issue_comments_path(comment.issue)
  form_method = comment.persisted? ? :put : :post
%>
<%= form_with model: comment, url: form_url, method: form_method,
  class: "flex flex-col gap-2" do |f| %>

  <%= react_component("MarkdownEditor", defaultValue: comment.content, mirrorInputTargetSelector: "input[data-comment-content='#{comment.id || 'new' }']") %>
  <%= f.hidden_field :content, data: { "comment-content": (comment.id || "new") }, required: true %>

  <div class="flex gap-2 justify-end">
    <% if comment.new_record? %>
      <%= button_tag t("actions.cancel"), type: "button", class: "btn btn-sm btn-ghost", data: { action: "issue--comments#hideForm" } %>
    <% else %>
      <%= f.submit t("actions.cancel"), value: 'cancel', class: "btn btn-sm btn-ghost", data: { action: "issue--comments#hideForm" } %>
    <% end %>
    <%= f.submit t("actions.save"), class: "btn btn-primary btn-sm", data: { action: "issue--comments#hideForm" } %>
  </div>
<% end %>